import {FlatList, HStack, Heading, Spinner, Text, View} from 'native-base';
import {IFlatListProps} from 'native-base/lib/typescript/components/basic/FlatList';
import NoData from '../NoData/NoData';
export type ListType = IFlatListProps<any> & {
  loading?: boolean;
};
export default function (params: ListType) {
  return (
    <View>
      <FlatList
        {...params}
        ListEmptyComponent={params.loading ? <></> : <NoData />}
      />
      {params.loading ? (
        <HStack justifyContent={'center'} py={'35'}>
          <Spinner color={'coolGray.500'}></Spinner>
          <Text color={'coolGray.400'} fontSize={'sm'}>
            Loading...
          </Text>
        </HStack>
      ) : (
        <></>
      )}
    </View>
  );
}
